export interface VideoItem {
  id: number | string
  title: string
  cover: string
  url: string
  uploader: string
  avatar: string
  views: number
  danmaku: number
  time: string
  type: 'live' | 'replay'
  desc?: string
  category?: string
  tags?: string[]
  location?: string
  distance?: number
}

export interface VideoListParams {
  page: number
  size: number
  category?: string
}

export interface VideoListResponse {
  code: number
  data: {
    list: VideoItem[]
    total: number
    hasMore: boolean
  }
  message: string
}

export interface VideoDetailResponse {
  code: number
  data: VideoItem
  message: string
}

export interface VideoState {
  videoList: VideoItem[]
  loading: boolean
  finished: boolean
  refreshing: boolean
  currentPage: number
  pageSize: number
}

export interface Category {
  id: number
  name: string
  icon: string
}

// 直播/视频项类型
export interface LiveItem {
  id: string | number
  title: string
  cover: string
  url: string
  type: 'live' | 'replay'
  views: number
  uploader: string
  avatar: string
}

// 视频播放器配置类型
export interface PlayerOptions {
  poster?: string
  fluid?: boolean
  aspectRatio?: string
  autoplay?: boolean
  controls?: boolean
  preload?: 'auto' | 'metadata' | 'none'
  width?: number | string
  height?: number | string
  controlBar?: {
    children?: string[]
    volumePanel?: {
      inline: boolean
      vertical: boolean
    }
  }
  playbackRates?: number[]
  language?: string
  controlBarVisibility?: number
  liveui?: boolean
}

// 播放器事件类型
export interface PlayerEvents {
  ready: (player: any) => void
  error: (error: { type: string; error: any }) => void
  play: () => void
  pause: () => void
  ended: () => void
  timeupdate: (currentTime: number) => void
  fullscreenchange: (isFullscreen: boolean) => void
}
